unit DokumentStatus;

interface

uses
  SysUtils;

const
  stTemeljnicaPrenosGKBit = 1;
  stTemeljnicaPrenosKIRBit = 2;
  stTemeljnicaPrenosKPRBit = 3;

function GetBit(ABitPos: Integer; AValue: Integer): Boolean;
procedure SetBit(ABitPos: Integer; ABitValue: Boolean; var AValue: Integer);

implementation

function GetBit(ABitPos: Integer; AValue: Integer): Boolean;
begin
  if (AValue and (1 shl (ABitPos - 1))) = 0 then
    Result := False
  else
    Result := True;
end;

procedure SetBit(ABitPos: Integer; ABitValue: Boolean; var AValue: Integer);
begin
  if (ABitPos >= 1) and (ABitPos <= 32) then
  begin
    if ABitValue then
      AValue := AValue or (1 shl (ABitPos - 1))
    else
      AValue := AValue and (not (1 shl (ABitPos - 1)));
  end
  else begin
    if ABitValue then
      AValue := MaxInt
    else
      AValue := 0;
  end;
end;

end.
